const express = require("express");
const app = express();
const path = require("path");
const APIROUTER = require("../routerConfig");
const cookieParser = require('cookie-parser');
app.use(cookieParser());

app.use(require("../middleWare/CORS"));
app.use(require('../middleWare/isToken'));





app.use(require("../middleWare/setGetMothCache"));
const p = path.resolve(__dirname,'../public');
app.use(express.static(p));
app.use(express.urlencoded({extended:true}));
app.use(express.json());


app.use(APIROUTER.apiHomeInfo,require("../api/homeInfo"));
app.use(APIROUTER.apiArticle,require("../api/article"));
app.use(APIROUTER.apiComment,require("../api/comment"));
app.use(APIROUTER.apiProject,require('../api/project'));
app.use(APIROUTER.apiAdmin,require('../api/admin'));
const port = 12000;
app.listen(port,()=>{
    console.log(`开始监听${port}端口`);
})
process.on('uncaughtException', function (err) {
    //打印出错误
    console.log(err);
    //打印出错误的调用栈方便调试
    console.log(err.stack);
  });